public class ctrl_ServiceLetterPDF
{
    //For Variables...
    public Request__c serviceObject {get;set;}
    public List<Entry_Permit__c> entryPermitsList {get;set;}
    public List<Product_Information__c > productsList {get;set;}
    public List<Share_Ownership_Request__c> shareOwnershipList {get;set;}
    public List<Account_Activity_Request__c> accountActivityRequestList {get;set;}
    private string serviceID = null;
    
    //For Constructors...
    public ctrl_ServiceLetterPDF(ApexPages.StandardController controller)
    {
        serviceObject = new Request__c();
        entryPermitsList = new List<Entry_Permit__c>();
        shareOwnershipList = new List<Share_Ownership_Request__c>();
        accountActivityRequestList = new List<Account_Activity_Request__c> ();
        productsList = new List<Product_Information__c>();
        
        if(ApexPages.CurrentPage().getParameters().get('Id') != null && ApexPages.CurrentPage().getParameters().get('Id') != '')
        {
            serviceID = ApexPages.CurrentPage().getParameters().get('Id');
            //serviceObject = [Select Name, Id,Title__c,Title_Arabic__c,Authorized_Manager_Name_Arabic__c ,Authorize_Manager_Nationality_Arabic__c,Company_Name_Arabic__c, License_Number__c, Company_Name_English__c,Authorized_Manager_Name__c,Authorize_Manager_Nationality__c,Authorize_Manager_Passport_Number__c, Contact__r.Nationality__r.Name,Contact__r.Current_Employer__r.Name, Contact__r.Visa_Reference_Number__c, Contact__r.Passport_Issue_Place__c, Contact__r.Passport_Issue_Country__c, Contact__r.Passport_Number_Formula__c, Contact__r.Name, Contact__r.FirstName, Contact__r.LastName, Contact__c From Request__c WHERE Id =: serviceID ];
            serviceObject = [SELECT Code__c, Company_Name_Arabic__c, Company_Name_English__c, Salary__c, Contact__r.Arabic_Name__c, Request_Type__r.Name,
                            Contact__r.Name, Contact__r.Nationality__r.Country_Arabic_Name__c, Contact__r.Job_Title_Arabic__c, Contact__r.Monthly_Salary__c,
                            Contact__r.Nationality__r.Name, Contact__r.Occupation__c, Contact__r.Passport_Number_Formula__c, Custom_Code_Number__c,
                            Emirates__r.Name, License_Number__c, License_Plate_Number_Code__c, New_Driving_License_Issued_Emirates__r.Name,
                            New_Location_Name__r.Name, Old_Driving_License_Country__r.Country_Arabic_Name__c, Old_Driving_License_Country__r.Name,
                            Old_Driving_License_Issued_Emirates__r.Name, Old_Location_Name__c, Port_Name__r.Name,Port_Name__r.Name_Arabic__c,Requested_For__r.Name, Vehicle_Model__c,
                            Vehicle_Type_Lookup__r.Name, Visiting_Country__r.Name, Purpose_Of_Visit__r.Name, Company_Capital__c,
                            Previous_Company_Name__c, Authorized_Manager_Name__c, Authorize_Manager_Nationality__c, Authorize_Manager_Passport_Number__c,
                            Contact__r.Employee_Contract__r.Monthly_Salary__c, Company__r.Chamber_Issue_Date__c, Company__r.License_State_Date__c,
                            Emirates__r.Name_Arabic__c, Vehicle_Type_Lookup__r.Name_Arabic__c, Requested_For__r.Name_Arabic__c,
                            Old_Driving_License_Issued_Emirates__r.Name_Arabic__c, New_Driving_License_Issued_Emirates__r.Name_Arabic__c,
                            CreatedDate, Company__r.Activity__c, Company__r.Company_Capital__c, Visiting_Country__r.Country_Arabic_Name__c,
                            Purpose_Of_Visit__r.Name_Arabic__c
                            FROM Request__c 
                            WHERE Id =: serviceID ];
                            
            entryPermitsList = new List<Entry_Permit__c>
                                ([SELECT Employee__r.Name, Employee__r.Nationality__r.Name, 
                                  Employee__r.Passport_Number_Formula__c, Employee__r.Occupation__c 
                                  FROM Entry_Permit__c
                                  WHERE Request_Number__c = :serviceID]);
            
            shareOwnershipList = new List<Share_Ownership_Request__c>
                                ([SELECT Share__c, Shareholder_Name__c, Shareholder_Nationality__c, Shareholder_Passport_Number__c
                                  FROM Share_Ownership_Request__c
                                  WHERE Request_Number__c = :serviceID]);
            
            accountActivityRequestList = new List<Account_Activity_Request__c>
                                        ([SELECT Activity__r.Name, Activity__r.Sub_Activity_Name_Arabic__c
                                          FROM Account_Activity_Request__c
                                          WHERE Request_Number__c = :serviceID]);
            
            productsList = new List<Product_Information__c>([SELECT Invoice_Number__c, Shipment_Number__c , 
                                                             Date__c, Country_Of_Origin__r.Name, 
                                                             Product_Type__r.Name
                                                             FROM Product_Information__c
                                                             WHERE Request_Number__c = :serviceID]);
        }
    
    }

}